<template>
  <div>
    <van-nav-bar
      :title="$t('order.inputForm')"
      left-arrow
      :fixed="true"
      @click-left="onClickLeft"
    />
    <!-- 选择收货地址 -->
    <van-contact-card
      :type="address_type"
      :add-text="$t('order.location')"
      :name="address_name"
      :tel="address_phone"
      @click="chooseAddress"
      style="margin-top: 3rem"
    />
    <van-cell-group>
      <van-cell
        :title="$t('order.arrivalTime')"
        :value="deliveryTime"
        is-link
        @click="showTimePickView"
      >
        <template slot="label">
          <span class="custom-title">{{ $t("order.outTimeGetMoney") }}</span>
          <van-icon name="question-o" />
        </template>
      </van-cell>
      <!-- 送货时间区间选择器 -->
      <TimeIntervalList
        ref="timeInterval"
        :showDateTimePopView="showDateTimePopView"
        @changeData="changeData(arguments)"
      ></TimeIntervalList>
    </van-cell-group>

    <!-- 路由出口 -->
    <transition name="router-slider" mode="out-in">
      <router-view></router-view>
    </transition>
  </div>
</template>

<script>
// 送货时间区间组件
import TimeIntervalList from "./children/TimeIntervalList";
export default {
  props: {},
  data() {
    return {
      address_type: "add", //地址卡片类型
      address_name: null, // 收货人
      address_phone: null, // 收货人电话
      address_id: null, // 收货人地址ID

      radio: "1", // 支付方式
      checked: false, // 积分兑换开关
      isShowPreferential: false, // 展示积分兑换
      integral: 800, // 积分,
      showList: false, // 展示优惠列表

      deliveryTime: this.$t("order.deliveryTime"),
      showDateTimePopView: false,
      coupons: [
        {
          // 优惠券信息
          available: 1,
          condition: this.$t("mine.condition"),
          reason: "",
          value: 150,
          name: this.$t("mine.bill"),
          startAt: 1549104000,
          endAt: 1614592000,
          valueDesc: "1.5",
          unitDesc: "元",
        },
        {
          // 优惠券信息
          available: 1,
          condition: this.$t("mine.condition"),
          reason: "",
          value: 200,
          name: this.$t("mine.bill"),
          startAt: 1549104000,
          endAt: 1614592000,
          valueDesc: "2",
          unitDesc: "元",
        },
      ],
      chosenCoupon: -1,
    };
  },
  computed: {},
  created() {},
  mounted() {},
  watch: {},
  methods: {
    // 2.返回到上个界面
    onClickLeft() {
      this.$router.back();
    },
    // 选择地址
    chooseAddress() {
      this.$router.push("/order/myAddress");
    },
    // 显示时间选择器
    showTimePickView() {
      this.showDateTimePopView = true;
    },
  },
  components: {
    TimeIntervalList,
  },
};
</script>

<style lang="less" scoped>
</style>
